/***************************************************************************
*   Copyright (C) 2011 by Chuck Gao & Alex Liu                             *
*                                                                          *
*   This program is free software: you can redistribute it and/or modify   *
*   it under the terms of the GNU General Public License as published by   *
*   the Free Software Foundation, either version 3 of the License, or      *
*   (at your option) any later version.                                    *
*                                                                          *
*   This program is distributed in the hope that it will be useful,        *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
*   GNU General Public License for more details.                           *
*                                                                          *
*   You should have received a copy of the GNU General Public License      *
*   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
*                                                                          *
*   Contact author: chuckgao.cg@gmail.com                                  *
*                   alex2202375@gmail.com                                  *
***************************************************************************/

import QtQuick 1.0

Item {
    id: menuGroup
    width: 360
    height: 540
    clip: true

    property int menuOffset: 0

    function showCookingMenu() {
        menu1.opacity = 0.1
        menu2.opacity = 0.1
        menu3.opacity = 0.1
        menu4.opacity = 0.1
        showMenuAnimation.running = true
    }

    function hideMenuBtns() {
        console.debug("MenuGroup, hideMenuBtns")
        var leavedPixel = 4
        menuOffset = menu1.width + 40;
        menuOffset = -menuOffset + leavedPixel;
        menu1.state = "hide"
        menu2.state = "hide"
        menu3.state = "hide"
        menu4.state = "hide"
    }

    SequentialAnimation {
        id: showMenuAnimation
        running: false

        property int animationDuration: 300
        NumberAnimation { target: menu1; property: "opacity"; from: 0.1; to: 0.8; duration: showMenuAnimation.animationDuration }
        NumberAnimation { target: menu2; property: "opacity"; from: 0.1; to: 0.8; duration: showMenuAnimation.animationDuration }
        NumberAnimation { target: menu3; property: "opacity"; from: 0.1; to: 0.8; duration: showMenuAnimation.animationDuration }
        NumberAnimation { target: menu4; property: "opacity"; from: 0.1; to: 0.8; duration: showMenuAnimation.animationDuration }
    }

    Column {
        id: btnsColumn
        anchors.centerIn: parent
        spacing: 10

        MenuBtn {
            id: menu1
            index: 0
            titleText: "食谱大全"
            opacity: 0.1
            color: "gray"
        }

        MenuBtn {
            id: menu2
            index: 1
            titleText: "饮食计划"
            opacity: 0.1
            color: "lightgreen"
        }

        MenuBtn {
            id: menu3
            index: 2
            titleText: "购物清单"
            opacity: 0.1
            color: "lightblue"
        }

        MenuBtn {
            id: menu4
            index: 3
            titleText: "食谱查询"
            opacity: 0.1
            color: "lightyellow"
        }
    }
}
